package com.hrrt.home.rpc.service.impl;


import com.github.pagehelper.PageHelper;
import com.hrrt.common.annotation.BaseService;
import com.hrrt.common.base.BaseServiceImpl;
import com.hrrt.common.db.DataSourceEnum;
import com.hrrt.common.db.DynamicDataSource;
import com.hrrt.home.dao.mapper.HomeBaseDeviceMapper;
import com.hrrt.home.dao.model.HomeBaseDevice;
import com.hrrt.home.dao.model.HomeBaseDeviceExample;
import com.hrrt.home.rpc.api.HomeBaseDeviceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;

/**
* HomeBaseDeviceService实现
* Created by shuzheng on 2017/9/1.
*/
@Service
@Transactional
@BaseService
public class HomeBaseDeviceServiceImpl extends BaseServiceImpl<HomeBaseDeviceMapper, HomeBaseDevice, HomeBaseDeviceExample> implements HomeBaseDeviceService {

    private static Logger _log = LoggerFactory.getLogger(HomeBaseDeviceServiceImpl.class);

    @Autowired
    HomeBaseDeviceMapper homeBaseDeviceMapper;

    @Override
    public List<HomeBaseDevice> selectBaseDeviceByExampleForOffsetPage(HomeBaseDeviceExample homeBaseDeviceExample, int offset, int limit) {
        try {
            PageHelper.offsetPage(offset, limit, false);
            List<HomeBaseDevice> result = homeBaseDeviceMapper.selectBaseDeviceByExample(homeBaseDeviceExample);
            return  result;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}